package com.study.wanandroid.utils

import android.app.Dialog
import android.content.Context
import com.study.wanandroid.R

/**
 * <pre>
 *     author : slx
 *     time   : 2020/11/28
 *     desc   :
 * </pre>
 */
object LoadingDialog {

    private var dialog: Dialog? = null

    fun showLoading(context: Context) {
        cancel()
        dialog = Dialog(context)
        dialog?.apply {
            setContentView(R.layout.dialog_loading)
            setCanceledOnTouchOutside(false)
            setCancelable(false)
            show()
        }
    }

    fun cancel() {
        dialog?.cancel()
    }
}